<template>
    <a-row style="padding-top:10px;" v-if="taskLinkupParam.bpmCmTaskInfos.length>0">
        <a-alert :message="i18n('taskComm.commDesc','你正与进行...')" type="info" closeText="关闭">
            <template #description>
                <ul>
                    <li v-for="item in taskLinkupParam.bpmCmTaskInfos">
                        {{ i18n('taskComm.comm', '沟通') }}:<span>{{ item.cmUserName }}</span>,
                        <span v-if="item.opinion==''">
                  <span style="color:red">{{ i18n('taskComm.notReply', '暂无回复。') }}</span><a-button type="link"
                                                                                                   @click="revokeCmTask(item.taskId)"
                                                                                                   size="small"><EditOutlined/>{{ i18n('taskComm.withdrawComm', '撤回沟通') }}</a-button>
                </span>
                        <span v-else>{{ i18n('taskComm.reply', '回复') }}：{{ item.opinion }}</span>
                    </li>
                </ul>
            </template>
        </a-alert>
    </a-row>
</template>

<script>
import BpmtaskApi from "@/common/api/bpm/bpmTask";

export default {
    name: "task-commu",
    emits: ['commuTaskRevoked'],
    props: {
        taskLinkupParam: {
            type: Object
        }
    },
    methods: {
        i18n(name, text, key) {
            return this.$ti18(name, text, "bpmTask", key);
        },
        //撤回沟通任务
        revokeCmTask(taskId) {
            let self = this;
            //进行任务撤回处理
            BpmtaskApi.revokeCmTask(taskId).then(resp => {
                this.$emit("commuTaskRevoked")
            });
        },
    }
}
</script>

<style scoped>

</style>
